// ignore_for_file: prefer_const_constructors_in_immutables

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:verse_systems/commom/config/config.dart';
import 'package:verse_systems/res/colors.dart';
import 'package:verse_systems/utils/images_path.dart';

class CustomizeHomeAppbar extends StatelessWidget {
  final String? title;
  final String? placard;
  final String? amount;
  final VoidCallback callBack;
  CustomizeHomeAppbar(
      {super.key,
      this.title = "",
      this.placard = "",
      this.amount = "",
      required this.callBack});

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 310.w,
      child: Stack(
        children: [
          Container(
            padding: EdgeInsets.fromLTRB(36.w, 39.w, 36.w, 0),
            height: 225.w,
            width: MediaQuery.of(context).size.width,
            decoration: BoxDecoration(
              image: DecorationImage(
                  image: ExactAssetImage(IMagesPath.getHomeBannerBg()),
                  fit: BoxFit.fill),
            ),
            child: Text.rich(TextSpan(children: [
              TextSpan(
                text: "${Config.getConfigPage()}${"loan".tr}",
                style: TextStyle(
                    fontSize: 18.sp,
                    color: Colours.app_main_color,
                    height: 1.5),
              ),
              TextSpan(
                text: "\n",
                style: TextStyle(
                    fontSize: 17.sp, color: Colors.black, height: 1.5),
              ),
              TextSpan(
                text: "compliance_services_loan".tr,
                style: TextStyle(
                    fontSize: 12.sp,
                    color: Colours.app_main_color,
                    height: 1.5),
              ),
            ])),
          ),
          Positioned(
            top: 95.w,
            child: Container(
              padding: EdgeInsets.symmetric(horizontal: 3.w),
              margin: EdgeInsets.symmetric(
                  horizontal: (MediaQuery.of(context).size.width - 330.w) / 2),
              width: 330.w,
              height: 205.w,
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(10.w)),
                  color: Colours.app_main_color,
                  boxShadow:  [
                    BoxShadow(
                        color:Colours.stringAnAlphaColor("0xff000000",alpha: 0.08),
                        offset: const Offset(0.0, 15.0), //阴影xy轴偏移量
                        blurRadius: 25.0, //阴影模糊程度
                        spreadRadius: 0.5 //阴影扩散程度
                        )
                  ]),
              child: Column(
                children: [
                  Container(
                      margin: EdgeInsets.fromLTRB(0, 10.w, 0, 15.w),
                      child: Row(
                        children: [
                          Image.asset(
                            IMagesPath.getHomePlacard(),
                            fit: BoxFit.fill,
                            width: 54.w,
                            height: 21.w,
                          ),
                          Container(
                              margin: EdgeInsets.only(left: 3.w),
                              width: 265.w,
                              child: Text("$placard",
                                  maxLines: 1,
                                  overflow: TextOverflow.ellipsis,
                                  style: TextStyle(
                                    color: Colours.app_line_color,
                                    fontSize: 11.sp,
                                  ))),
                        ],
                      )),
                  Text("amount".tr,
                      maxLines: 1,
                      overflow: TextOverflow.ellipsis,
                      style: TextStyle(
                        color: Colours.app_black_text_color,
                        fontSize: 13.sp,
                      )),
                  Container(
                    margin: EdgeInsets.fromLTRB(0, 10.w, 0, 15.w),
                    child: Text("$amount",
                        maxLines: 1,
                        overflow: TextOverflow.ellipsis,
                        style: TextStyle(
                          color: Colours.app_black_text_color,
                          fontSize: 42.sp,
                        )),
                  ),
                  InkWell(
                    onTap: callBack,
                    child: Container(
                      height: 46.w,
                      width: 230.w,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.all(Radius.circular(23.w)),
                        color: Colours.app_main_background_color,
                      ),
                      alignment: Alignment.center,
                      child: Text("$title",
                          style: TextStyle(
                              fontSize: 16.sp, color: Colours.app_main_color)),
                    ),
                  )
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}
